package com.gitee.l0km.beanfilter.annotations;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import com.gitee.l0km.beanfilter.core.CodecPhase;
import com.gitee.l0km.beanfilter.core.CodecScope;
import com.gitee.l0km.beanfilter.core.IFieldFilter;
import com.gitee.l0km.common.spring.core.annotation.AliasFor;

/**
 * 字段过滤器注解，可以作为元注解，也可以直接定义在服务方法上<br>
 * 字段说明参见 {@link FilterMeta}同名字段
 * @author guyadong
 *
 */
@Retention(RUNTIME)
@Target({ ANNOTATION_TYPE, METHOD })
@Repeatable(FieldFilters.class)
@FilterMeta(phase = CodecPhase.SERIALIZATION)
public @interface FieldFilter {
	@AliasFor(annotation = FilterMeta.class,attribute = "filterClass")
	Class<? extends IFieldFilter> filterClass() default IFieldFilter.class;
	@AliasFor(annotation = FilterMeta.class,attribute = "filterClassName")
	String filterClassName() default "";
	@AliasFor(annotation = FilterMeta.class,attribute = "beanClass")
	Class<?> beanClass() default Object.class;
	/**
	 * @see FilterMeta#phase()
	 */
	@AliasFor(annotation = FilterMeta.class,attribute = "phase")
	CodecPhase phase() default CodecPhase.SERIALIZATION;
	/**
	 * @see FilterMeta#scope()
	 */
	@AliasFor(annotation = FilterMeta.class,attribute = "scope")
	CodecScope scope() default CodecScope.ALL;
}
